package windows;


import coordinators.Cordinator;

import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.WindowConstants;

public class WindowPrincipal extends JFrame implements ActionListener,KeyListener
{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private Container Contenedor;
	private JMenuBar mnbbarMain;

	private JMenu mnuAcercade;
	private JMenuItem mniCreators;
	private JButton btnExit;
	private JButton btnManage;
	private JButton btnPastryCook;

	private JMenu mnuFile;
	private JMenuItem mniOut;

	private JLabel lblNamePastry;
	private JLabel lblNit;
	private JLabel lblSlogan;
	
	Cordinator coordinator;


	public WindowPrincipal()
	{
		Contenedor = getContentPane();
		Contenedor.setLayout(null);

		mnbbarMain = new JMenuBar();
		setJMenuBar(mnbbarMain);

		mnuFile=new JMenu("Archivos");
		mniOut=new JMenuItem("Salir");
		mnuFile.add(mniOut);
		mnbbarMain.add(mnuFile);

		mnuAcercade = new JMenu("Acerca De");
		mniCreators = new JMenuItem("Creadores");
		mnuAcercade.add(mniCreators);
		mnbbarMain.add(mnuAcercade);

		btnExit = new JButton("Salir");
		btnExit.setBounds(370,140,80,25);
		Contenedor.add(btnExit);

		btnManage= new JButton("administrador");
		btnManage.setBounds(50,100,130,25);
		btnManage.addActionListener(this);
		Contenedor.add(btnManage);

		btnPastryCook = new JButton("Pastelero");
		btnPastryCook.setBounds(50,140,130,25);
		btnPastryCook.addActionListener(this);
		Contenedor.add(btnPastryCook);

	
		lblNamePastry = new JLabel("PASTELERIA LA UNICA");
		lblNamePastry.setFont(new Font("Times New Roman", 3, 18));
		lblNamePastry.setForeground(new java.awt.Color(0, 0, 153));
		lblNamePastry.setBounds(300,20,240,30);
		Contenedor.add(lblNamePastry);

		lblNit = new JLabel("NIT: 123.456.789-0");
		lblNit.setFont(new Font("Script MT Bold", 3, 18));
		lblNit.setForeground(new java.awt.Color(0, 0, 153));
		lblNit.setBounds(325,50,180,30);
		Contenedor.add(lblNit);

		lblSlogan =new JLabel("lema pasteleria");
		lblSlogan.setFont(new Font("Arial", 3, 14));
		lblSlogan.setForeground(new java.awt.Color(0, 0, 153));
		lblSlogan.setBounds(300,90,250,30);
		Contenedor.add(lblSlogan);

		setSize(600,270);
		setLocation(250,200);
		setResizable(false);


		
		mniCreators.addActionListener(this);
		mniOut.addActionListener(this);
		btnExit.addActionListener(this);
		
		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	}

	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource()==mniOut)
		{
			System.exit(0);
		}

		if(e.getSource()==btnExit)
		{
			System.exit(0);
		}
		if(e.getSource()==btnManage)
		{
			coordinator.ProcessWindowAdministrator();
		}
		if(e.getSource()==btnPastryCook)
		{
			coordinator.ProcessWindowPastry();
		}
		if(e.getSource()==mniCreators)
		{
			coordinator.ProcessWindowCreators();
		}
	}

	public void keyPressed(KeyEvent e)
	{
		// TODO Auto-generated method stub
	}

	public void keyReleased(KeyEvent e)
	{
		// TODO Auto-generated method stub
	}

	public void keyTyped(KeyEvent e)
	{
		// TODO Auto-generated method stub
	}

	public void setCoordinador(Cordinator c)
	{
		coordinator = c;
	}

}
